<?php 

	
	namespace Home\Controller;
	use Think\Controller;
	class SetController extends Controller{
		//发送邮件的方法
		//
		
		public function sendemail()
		{
			 $email = I('post.email');
             $mail = md5($email);

			$content = <<<str
	<div id="contentDiv" onmouseover="getTop().stopPropagation(event);" onclick="getTop().preSwapLink(event, 'html', 'ZC4706-TRULub_119k_GDxkVQWlO74');"
style="position:relative;font-size:14px;height:auto;padding:15px 15px 10px 15px;z-index:1;zoom:1;line-height:1.7;"
class="body">
    <div id="qm_con_body">
        <div id="mailContentContainer" class="qmbox qm_con_body_content qqmail_webmail_only"
        style="">
            <table style="width: 600px; border: 1px solid #ddd; border-radius: 3px; color: #555; font-family: 'Helvetica Neue Regular',Helvetica,Arial,Tahoma,'Microsoft YaHei','San Francisco','微软雅黑','Hiragino Sans GB',STHeitiSC-Light; font-size: 12px; height: auto; margin: auto; overflow: hidden; text-align: left; word-break: break-all; word-wrap: break-word;"
            cellspacing="0" cellpadding="0" border="0">
                <tbody style="margin: 0; padding: 0;">
                    <tr style="background-color: #393D49; height: 60px; margin: 0; padding: 0;">
                        <td style="margin: 0; padding: 0;">
                            <div style="color: #5EB576; margin: 0; margin-left: 30px; padding: 0;">
                                <a style="font-size: 14px; margin: 0; padding: 0; color: #5EB576; text-decoration: none;"
                                href="http://fly.layui.com/" target="_blank">
                                    Fly社区 - Layui前端框架官方社区
                                </a>
                            </div>
                        </td>
                    </tr>
                    <tr style="margin: 0; padding: 0;">
                        <td style="margin: 0; padding: 30px;">
                            <p style="line-height: 20px; margin: 0; margin-bottom: 10px; padding: 0;">
                                Hi，
                                <em style="font-weight: 700;">
                                    翠烟袅袅
                                </em>
                                ，请完成以下操作：
                            </p>
                            <div style="">
                                <a href="http://127.0.0.1/self_lx/3-28/Bbs/index.php/home/set/active/id/{$mail}.html"
                                style="background-color: #009E94; color: #fff; display: inline-block; height: 32px; line-height: 32px; margin: 0 15px 0 0; padding: 0 15px; text-decoration: none;"
                                target="_blank">
                                    立即激活邮箱
                                </a>
                            </div>
                            <p style="line-height: 20px; margin-top: 20px; padding: 10px; background-color: #f2f2f2; font-size: 12px;">
                                如果该邮件不是由你本人操作，请勿进行激活！否则你的邮箱将会被他人绑定。
                            </p>
                        </td>
                    </tr>
                    <tr style="background-color: #fafafa; color: #999; height: 35px; margin: 0; padding: 0; text-align: center;">
                        <td style="margin: 0; padding: 0;">
                            系统邮件，请勿直接回复。
                        </td>
                    </tr>
                </tbody>
            </table>
            <style type="text/css">
                .qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {display:
                none !important;}
            </style>
        </div>
    </div>
    <!-- -->
    <style>
        #mailContentContainer .txt {height:auto;}
    </style>
</div>
str;
	$title = "Fly社区激活邮件";
			// xbsemail('1150385523@qq.com','php',$content);
			

			if (xbsemail($email,$title,$content)) {
				$arr = array(
    			'error'=>0,
    			'info'=>'发送邮件的成功'
    			);
            
    		echo json_encode($arr);
    		exit();
			}else{
				$arr = array(
    			'error'=>1,
    			'info'=>'发送失败'
    			);
    		echo json_encode($arr);
    		exit();
			}
			
		}

        //邮箱激活的方法
        public function active()
        {   
            $user = D('user')->getOneuser();


            $mail = I('get.id');

            if ($mail==md5($user['email'])) {
                M('user')->where(array('id'=>$user['id']))->save(array('e_status'=>1));
               
                $this->error('激活成功',U('home/set/succe'),5);
                
            }else{
                
                $this->error('激活失败',U('home/set/index'),5);
            }
        }



		public function index()
		{

			 $user = D('user')->getOneuser();
             $this->assign('user',$user);
			layout('left');
			$this->display();
		}

        //发送成功跳转的界面
        public function succe()
        {

            $user = D('user')->getOneuser();
            $this->assign('user',$user);
            layout('left');
            $this->display();
        }


}



 ?>